<div class="row m-n">
    <div class="crumbs-bar">
        <div yb-crumbs></div>
    </div>
    <div tabset type="tab">
        <div tab heading="保养包" active="activeFlag[0]" ng-click="changeTab(0)">
            <div class="row wrapper-y-sm">
                <div class="operate-bar col-xs-4 font-0">
                    <button class="btn btn-operate m-r-sm" ng-disabled="!btnPermission.commonQueryAdd"
                            ng-click="addData()">新增</button>
                </div>
                <div class="search-bar wrapper-none col-xs-8">
                    <div class="input-group pull-right clearfix">
                        <input type="text" class="form-control txt-search" ng-model="condition.maintenanceName" placeholder="保养包名称">
                        <span class="input-group-addon cursor-pointer" ng-click="search(1)">搜索</span>
                    </div>
                </div>
            </div>
            <div class="main-area d-b-15">
                <div yb-table-fixed class="table-fixed-wrap">
                    <div class="th-scroll-x">
                        <table class="table border-none">
                            <thead>
                            <tr>
                                <th width="75%">保养包名称（机型名称）</th>
                                <th width="25%">操作</th>
                            </tr>
                            </thead>
                        </table>
                    </div>
                    <div class="td-scroll" ng-show="dataList.length > 0">
                        <table class="table border-none">
                            <tbody ng-repeat="item in dataList track by $index" class="border-none">
                                <tr ng-bind="parentIndex=$index" style="display:none"></tr>
                                <tr>
                                    <td width="75%" class="spill-dots" title="{{item.maintenanceName}}">
                                        <i ng-if="item.children&&item.children.length>0" class="yb-icon m-r-xs cursor-pointer"
                                           ng-class="{'ico-minus-square-o':item.isExpand, 'ico-plus-square-o':!item.isExpand}"
                                           ng-click="item.isExpand = !item.isExpand"></i>
                                        {{item.maintenanceName}}
                                    </td>
                                    <td width="25%" class="font-0">
                                        <button ng-disabled="!btnPermission.commonQueryEdit"
                                                class="btn btn-operate m-r-xs" ng-click="editData(item.id)">编辑</button>
                                        <button ng-disabled="!btnPermission.commonQueryDelete"
                                                class="btn btn-operate m-r-xs" ng-click="deleteMaintenance(item.id, $index)">删除</button>
                                    </td>
                                </tr>
                                <tr ng-repeat="child in item.children track by $index" ng-if="item.isExpand">
                                    <td class="spill-dots p-l-xl" title="{{child.modelName}}">
                                        {{child.modelName}}
                                    </td>
                                    <td class="font-0">
                                        <button ng-disabled="!btnPermission.commonQueryDelete"
                                                class="btn btn-operate m-r-xs" ng-click="deleteModel(child.id, parentIndex, $index)">删除</button>
                                        <button ng-disabled="!btnPermission.commonQueryMaterial"
                                                class="btn btn-operate" ng-click="configMaterial(child.id)">维护零件</button>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="no-data w-full text-center p-t" ng-show="root.children.length === 0">暂时没有数据</div>
                </div>
            </div>
        </div>
        <div tab heading="{{flagInfo.name}}" active="activeFlag[1]" ng-click="changeTab(1)" ng-if="activeFlag[1]">
            <div class="main-area d-t-35 d-b-60">
                <form name="form" class="main-wrap form-horizontal single-col p-t clearfix" novalidate>
                    <div class="form-group">
                        <label class="col-xs-2 control-label"><i>*</i>保养包名称：</label>
                        <div class="col-xs-5 wrapper-none">
                            <input type="text" name="realName" class="form-control" ng-model="detailInfo.commonMaintenanceDO.maintenanceName" required
                                   yb-focus maxlength="20">
                        </div>
                        <div class="col-xs-4 msg-block"
                             ng-show="form.realName.$dirty || (form.realName.$invalid && submitted)">
                            <div class="error-msg" ng-if="form.realName.$error.required && !form.realName.focused">
                                <i class="yb-icon ico-times-circular"></i>必填项，请填写
                            </div>
                        </div>
                    </div>
                    <div class="form-group m-b-xs">
                        <label class="col-xs-2 control-label"><i>*</i>机型：</label>
                        <div maintenance-selector box-click="selectMaintenance()" select-model-name="detailInfo.selectModelName"
                             maintenance-list="detailInfo.maintenanceList" class="col-xs-5 wrapper-none dropdown-prop"></div>
                        <div class="col-xs-4 msg-block" ng-show="submitted && !dataSelected.role.name">
                            <div class="error-msg">
                                <i class="yb-icon ico-times-circular"></i>请选择机型
                            </div>
                        </div>
                    </div>
                </form>
            </div>
            <div class="bottom-area btn-bar text-center clearfix">
                <button type="button" class="btn btn-primary m-r-sm" ng-click="saveData()">保存</button>
                <button type="button" class="btn btn-default m-r-sm" ng-click="cancel()">取消</button>
            </div>
        </div>
        <div tab heading="维护零件" active="activeFlag[2]" ng-click="changeTab(2)" ng-if="activeFlag[2]">
            <div class="row wrapper-y-xs">
                <div class="col-xs-12 operate-bar font-0">
                    <button class="btn btn-operate m-r-sm" ng-click="selMateriel($event)">选择零件</button>
                    <button class="btn btn-operate m-r-sm" ng-click="importMateriel()">导入零件</button>
                    <button class="btn btn-operate m-r-sm" ng-click="batchDelMateriel()">批量删除</button>
                </div>
            </div>
            <div materiel-selector show-toolbar="toolbarConfig.showMateriel" is-default-warehouse="true" selected-list="detailInfo.materialList"
                 warehouse-code="" area-code="" mark-stock-status="true"></div>
            <div class="main-area d-b-60" style="top:75px;">
                <div yb-table-fixed class="table-fixed-wrap">
                    <div class="th-scroll-x">
                        <table class="table-fixed border-none" width="{{newTbConf.scrollWidth}}">
                            <thead>
                                <tr>
                                    <th width="20" class="th-check text-center">
                                        <div yb-check-box yb-checked="markInfo.allCheckedMaterial" yb-click="selectAll(detailInfo.materialList, 'Material')"></div>
                                    </th>
                                    <th width="40">
                                        操作
                                    </th>
                                    <th ng-repeat="itemCol in newTbConf.tableCol track by $index" width="{{itemCol.width}}">
                                        <div yb-thead-operate ng-model="itemCol" target-width="newTbConf.scrollWidth"></div>
                                    </th>
                                </tr>
                            </thead>
                        </table>
                    </div>
                    <div class="td-scroll" ng-show="detailInfo.materialList.length > 0">
                        <table class="table-fixed border-none" width="{{newTbConf.scrollWidth}}">
                            <tbody>
                            <tr ng-repeat="item in detailInfo.materialList track by $index">
                                <td width="20" class="text-center">
                                    <div yb-check-box yb-checked="item.isChecked" yb-click="selectSingle(item, detailInfo.materialList, 'Material')"></div>
                                </td>
                                <td width="40">
                                    <button type="button" class="btn btn-operate" ng-click="delMateriel($index)">删除</button>
                                </td>
                                <td ng-repeat="itemCol in newTbConf.tableCol track by $index" width="{{itemCol.width}}"
                                    title="{{item[itemCol.dataField]}}">
                                    <div class="spill-dots" ng-if="!itemCol.input">
                                        <a class="btn-operate m-r-xs" ng-click="tdClick(item, itemCol.clickFn)" ng-if="!!itemCol.clickFn">
                                            {{item[itemCol.dataField]}}
                                        </a>
                                        <span ng-if="!itemCol.clickFn">
                                            {{item[itemCol.dataField]}}
                                        </span>
                                    </div>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="no-data w-full text-center p-t" ng-show="orderObj.materialList.length === 0">暂时没有数据</div>
                </div>
                <div class="bottom-area page-bar wrapper-y-sm clearfix" style="bottom:20px;right:30px;">
                    <div yb-page-info ng-model="pageInfo" yb-refresh="searchMateriel()"></div>
                </div>
            </div>
            <div class="bottom-area btn-bar text-center clearfix">
                <button type="button" class="btn btn-primary m-r-sm" ng-click="saveMaterial()">提交</button>
                <button type="button" class="btn btn-default m-r-sm" ng-click="cancel()">取消</button>
            </div>
        </div>
    </div>
</div>